package com.efast.dmom.mgmt.controller.les.pda;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.efast.cafe.framework.bean.ResultBean;
import com.efast.dmom.mgmt.bean.les.GroundingBean;
import com.efast.dmom.mgmt.service.les.TwInbTaskDetailService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * @author chlp
 */
@Controller
@RequestMapping(value = "/pdaTwInbTaskHeader")
@Api(description = "pda-->入库-->整单上架页面/明细上架")
public class PdaTwInbTaskHeaderController {

	private final TwInbTaskDetailService twInbTaskDetailService;

	@Autowired
	public PdaTwInbTaskHeaderController(TwInbTaskDetailService twInbTaskDetailService) {
		this.twInbTaskDetailService = twInbTaskDetailService;
	}

	/**
	 * 7.5.1.7整单上架
	 *
	 * 扫描或者输入上架任务单号，显示出这张单据所有信息，页面不可修改任何信息，只是展示，点击确认，进行整单上架操作
	 * 
	 * @param groundingBean
	 *            groundingBean
	 *
	 *            请求参数 { "TwInbTaskHeader":{ "twInbTaskHeaderId":"", "asnSheetNo":"" }, "TwInbTaskDetail":[ {
	 *            "actNboundQty":"", "inboundPackQty":"", "stageBasStorageId":"", "actTmBasStorageId":"",
	 *            "actTmBasStorageNo":"", "preInbPackNum":"", "actInbPackNum":"", "preNboundQty":"",
	 *            "twInbTaskDetailId":"", "partNoVersion":"" } ] }
	 */
	@ApiOperation(value = "【整单确认上架】", notes = "请求参数：")
	@RequestMapping(value = "/grounding", method = RequestMethod.POST)
	public @ResponseBody ResultBean headerGrounding(@RequestBody GroundingBean groundingBean) {
		ResultBean result = new ResultBean(true, "'");
		twInbTaskDetailService.grounding(groundingBean);
		return result;
	}

	/**
	 * 7.5.1.8按明细上架
	 *
	 * 扫描或者输入上架任务单号，显示出这张单据所有明细的信息，多条情况下，显示下一条，按需求编辑后，点击确认，进行上架
	 *
	 * @param groundingBean
	 *            groundingBean
	 *
	 *            请求参数 { "TwInbTaskHeader":{ "twInbTaskHeaderId":"", "asnSheetNo":"" }, "TwInbTaskDetail":[ {
	 *            "actNboundQty":"", "inboundPackQty":"", "stageBasStorageId":"", "actTmBasStorageId":"",
	 *            "actTmBasStorageNo":"", "preInbPackNum":"", "actInbPackNum":"", "preNboundQty":"",
	 *            "twInbTaskDetailId":"", "partNoVersion":"" } ] }
	 */
	@ApiOperation(value = "【明细确认上架】", notes = "请求参数：")
	@RequestMapping(value = "/detailGrounding", method = RequestMethod.POST)
	public @ResponseBody ResultBean detailGrounding(@RequestBody GroundingBean groundingBean) {
		ResultBean result = new ResultBean(true, "'");
		twInbTaskDetailService.grounding(groundingBean);
		return result;
	}

}
